package ltd.latewhale.whalenest.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import ltd.latewhale.whalenest.DTO.commentsCountDTO;
import ltd.latewhale.whalenest.DTO.commentsDTO;
import ltd.latewhale.whalenest.model.commentsDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface commentsMapper extends BaseMapper<commentsDO> {

    @Select("SELECT pid AS id,COUNT(pid) AS count FROM comments GROUP BY pid;")
    List<commentsCountDTO> getCount();

}
